<%--
  Created by IntelliJ IDEA.
  User: Raytine
  Date: 2020/1/13
  Time: 17:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="author" content="Kodinger">
    <title>mysqlExecute 重置密码</title>
    <link rel="stylesheet" type="text/css" href="../bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../css/my-login.css">
    <link href="img/favicon.png" rel="shortcut icon" />

</head>
<body class="my-login-page">
<section class="h-100">
    <div class="container h-100">
        <div class="row justify-content-md-center align-items-center h-100">
            <div class="card-wrapper">
                <div class="brand">
                    <img src="../img/timg.jpg">
                </div>
                <div class="card fat">
                    <div class="card-body">
                        <h4 class="card-title">重置密码</h4>
                        <form method="POST">
                            <a id="msg" style="color:red" ></a>
                            <div class="form-group">
                                <label for="password">输入新密码</label>
                                <input id="password" type="password" class="form-control" name="password" required autofocus data-eye>
                                <div class="form-text text-muted">
                                    请牢记密码！
                                </div>
                            </div>

                            <div class="form-group no-margin">
                                <button id="submit" type="button" class="btn btn-primary btn-block">
                                    重置密码
                                </button>
                            </div>
                            <br>
                            <center><img  id="submitDisImg"></center>
                        </form>
                    </div>
                </div>
                <div class="footer">
                    Copyright&copy;NextStep Company 2020 我们砥砺前行，不畏风雨。<br><br>
                    <a href="https://blog.csdn.net/weixin_40652498" title="下一步科技" target="_blank">下一步科技</a>
                </div>
            </div>
        </div>
    </div>
</section>

<script src="../js/jquery.min.js"></script>
<script src="../bootstrap/js/bootstrap.min.js"></script>
<script src="../js/my-login.js"></script>
</body>
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<script type="text/javascript">
    document.getElementById("submit").onclick=function(){
        var password = document.getElementById("password").value;
        if(password==""){
            alert("请输入密码。");
            return ;
        }
        document.getElementById("msg").innerHTML="";

        $.ajax({
            url:"updatePasswordEnter",     //请求地址
            contentType:"application/json;charset=UTF-8",  //传输数据类型
            data: JSON.stringify({password:password}),  //要传输的数据
            dataType:"json",   //返回值类型
            type:"post",     //请求方式
            success:function(msg){  //data表示服务端响应的数据
                if("success"==msg){
                    alert("修改密码成功，请牢记你修改后的密码！");
                    window.location.href = '../login.jsp';
                }else{
                    document.getElementById("msg").innerHTML="修改密码失败，请重试！";
                    document.getElementById("submitDisImg").src="";
                }
            },

        });
    }

</script>
</html>
